import { IPSDEUICtrlInvokeLogic } from './ipsdeuictrl-invoke-logic';
import { IPSDEUILogic } from './ipsdeuilogic';
import { IPSDEUILogicParam } from './ipsdeuilogic-param';
import { PSDEUILogicNodeImpl } from './psdeuilogic-node-impl';

export class PSDEUICtrlInvokeLogicImpl extends PSDEUILogicNodeImpl implements IPSDEUICtrlInvokeLogic {
  protected invokectrl: IPSDEUILogicParam | null = null;

  getInvokeCtrl(): IPSDEUILogicParam | null {
    if (this.invokectrl != null) return this.invokectrl;
    const value = this.M.getInvokeCtrl;
    if (value == null) {
      return null;
    }
    const ipsdeuilogic = this.getParentPSModelObject('dataentity.logic.IPSDEUILogic') as IPSDEUILogic;
    if (ipsdeuilogic != null) {
      this.invokectrl = ipsdeuilogic.findPSDEUILogicParam(value);
    }
    return this.invokectrl;
  }

  get invokeCtrl(): IPSDEUILogicParam | null {
    return this.getInvokeCtrl();
  }

  getInvokeCtrlMust(): IPSDEUILogicParam {
    const value = this.getInvokeCtrl();
    if (value == null) {
      throw new Error('未指定调用部件');
    }
    return value;
  }

  get invokeMethod(): string {
    return this.M.invokeMethod;
  }

  protected invokeparam: IPSDEUILogicParam | null = null;

  getInvokeParam(): IPSDEUILogicParam | null {
    if (this.invokeparam != null) return this.invokeparam;
    const value = this.M.getInvokeParam;
    if (value == null) {
      return null;
    }
    const ipsdeuilogic = this.getParentPSModelObject('dataentity.logic.IPSDEUILogic') as IPSDEUILogic;
    if (ipsdeuilogic != null) {
      this.invokeparam = ipsdeuilogic.findPSDEUILogicParam(value);
    }
    return this.invokeparam;
  }

  get invokeParam(): IPSDEUILogicParam | null {
    return this.getInvokeParam();
  }

  getInvokeParamMust(): IPSDEUILogicParam {
    const value = this.getInvokeParam();
    if (value == null) {
      throw new Error('未指定调用参数');
    }
    return value;
  }

  protected srcpsdeuilogicparam: IPSDEUILogicParam | null = null;

  getSrcPSDEUILogicParam(): IPSDEUILogicParam | null {
    if (this.srcpsdeuilogicparam != null) return this.srcpsdeuilogicparam;
    const value = this.M.getSrcPSDEUILogicParam;
    if (value == null) {
      return null;
    }
    const ipsdeuilogic = this.getParentPSModelObject('dataentity.logic.IPSDEUILogic') as IPSDEUILogic;
    if (ipsdeuilogic != null) {
      this.srcpsdeuilogicparam = ipsdeuilogic.findPSDEUILogicParam(value);
    }
    return this.srcpsdeuilogicparam;
  }

  get srcPSDEUILogicParam(): IPSDEUILogicParam | null {
    return this.getSrcPSDEUILogicParam();
  }

  getSrcPSDEUILogicParamMust(): IPSDEUILogicParam {
    const value = this.getSrcPSDEUILogicParam();
    if (value == null) {
      throw new Error('未指定源逻辑参数对象');
    }
    return value;
  }

  get cls(): string {
    return 'PSDEUICtrlInvokeLogicImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'dataentity.logic.IPSDEUICtrlInvokeLogic') return true;
    return super.instanceof(cls);
  }
}
